package com.composite;

public class Test {
    public static void main(String[] args) {

        //从大到小创建对象
        //学校
        University university = new University("上海大学","双一流");
        //学院
        College college = new College("计算机学院", "");
        College college1 = new College("轨道交通学院","");
        //系
        college.add(new Department("物联网工程" ,""));
        college.add(new Department("软件工程" ,""));
        college.add(new Department("大数据技术" ,""));

        college1.add(new Department("车辆工程" ,""));
        college1.add(new Department("控制工程" ,""));

        university.add(college);
        university.add(college1);
        university.print();


        //好处就是如果想要单独输出某个学院下面的系，可以直接输出
        System.out.println("-----------------单独输出某个学院----------------------");
        college.print();
    }
}
